home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 419_01 / odmg10 / config / Imake.rules < prev    next >
Encoding:
Text File  |  1994-02-21  |  48.9 KB  |  1,699 lines

  1. XCOMM -------------------------------------------------------------------------
  2. XCOMM Imake rules for building libraries, programs, scripts, and data files
  3. XCOMM rules:  $XConsortium: Imake.rules,v 1.121 91/08/22 16:32:50 rws Exp $
  4.  
  5. /*
  6.  *           MACHINE-INDEPENDENT RULES; DO NOT MODIFY
  7.  *
  8.  * Warning, when defining rules: make sure you do not include both a trailing
  9.  * backslash and double ampersand backslash or else you will get an extra
  10.  * backslash in the Makefile.
  11.  * 
  12.  * The following macros are defined for the various templates and Imakefiles
  13.  * (for a list of the applicable make variables, see the template files):
  14.  * 
  15.  * SaberProgramTarget        (program,srclist,objlist,locallibs,syslibs)
  16.  * RemoveTargetProgram        (program)
  17.  * MakeDir            (dir)
  18.  * BuildIncludes        (srclist,dstsubdir,dstupdir)
  19.  * NormalProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  20.  * SetUIDProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  21.  * SingleProgramTarget        (program,objects,locallibs,syslibs)
  22.  * SimpleProgramTarget        (program)
  23.  * ComplexProgramTarget        (program)
  24.  * ComplexProgramTarget_1    (program,locallib,syslib)
  25.  * ComplexProgramTarget_2    (program,locallib,syslib)
  26.  * ComplexProgramTarget_3    (program,locallib,syslib)
  27.  * ServerTarget            (server,subdirs,objects,libs,syslibs)
  28.  * RanLibrary            (args)
  29.  * InstallLibrary        (libname,dest)
  30.  * MergeIntoInstalledLibrary    (tolib,fromlib)
  31.  * InstallLibraryAlias        (libname,alias,dest)
  32.  * InstallLintLibrary        (libname,dest)
  33.  * InstallManPageLong        (file,destdir,dest)
  34.  * InstallManPage        (file,destdir)
  35.  * InstallManPageAliases    (file,destdir,aliases)
  36.  * InstallNamedNonExec        (srcname,dstname,dest)
  37.  * InstallNonExecFile        (file,dest)
  38.  * InstallNonExec        (file,dest)
  39.  * InstallProgramWithFlags    (program,dest,flags)
  40.  * InstallProgram        (program,dest)
  41.  * InstallScript        (program,dest)
  42.  * InstallNamedProg        (srcname,dstname,dest)
  43.  * LinkFileList            (step,list,dir,sub)
  44.  * InstallMultipleDestFlags    (step,list,dest,flags)
  45.  * InstallMultipleDest        (step,list,dest)
  46.  * InstallMultiple        (list,dest)
  47.  * InstallMultipleFlags        (list,dest,flags)
  48.  * InstallMultipleMan        (list,dest)
  49.  * InstallAppDefaults        (class)
  50.  * InstallAppDefaultsLong    (file,class)
  51.  * InstallIncludes        (srclist,dstsubdir)
  52.  * DependDependency        ()
  53.  * DependTarget            ()
  54.  * DependTarget3        (srcs1,srcs2,srcs3)
  55.  * CleanTarget            ()
  56.  * TagsTarget            ()
  57.  * ImakeDependency        (target)
  58.  * BuildMakefileTarget        (notused,imakeflags)
  59.  * MakefileTarget        ()
  60.  * LibMkdir            (dir)
  61.  * LibCleanDir            (dir)
  62.  * ObjectCompile        (options)
  63.  * NormalLibObjCompile        (options)
  64.  * NormalSharedLibObjCompile    (options)
  65.  * LibObjCompile        (dir,options)
  66.  * DebuggedLibObjCompile    (options)
  67.  * ProfiledLibObjCompile    (options)
  68.  * SharedLibObjCompile        (options)
  69.  * NormalLibraryObjectRule    ()
  70.  * NormalFortranObjectRule    ()
  71.  * ObjectFromSpecialSource    (dst,src,flags)
  72.  * SpecialObjectRule        (objs,depends,options)
  73.  * NormalLibraryTarget        (libname,objlist)
  74.  * NormalLibraryTarget2        (libname,objlist1,objlist2)
  75.  * NormalLibraryTarget3        (libname,objlist1,objlist2,objlist3)
  76.  * NormalDepLibraryTarget    (libname,deplist,objlist)
  77.  * SubdirLibraryRule        (objlist)
  78.  * ProfiledLibraryTarget    (libname,objlist)
  79.  * DebuggedLibraryTarget    (libname,objlist)
  80.  * AliasedLibraryTarget        (libname,alias)
  81.  * NormalRelocatableTarget    (objname,objlist)
  82.  * ProfiledRelocatableTarget    (objname,objlist)
  83.  * DebuggedRelocatableTarget    (objname,objlist)
  84.  * LintLibraryTarget        (libname,srclist)
  85.  * NormalLintTarget        (srclist)
  86.  * LintTarget            ()
  87.  * LinkSourceFile        (src,dir)
  88.  * LinkFile            (tofile,fromfile)
  89.  * MakeSubincludesForBuild    (step,dir,srclist)
  90.  * NamedTargetSubdirs        (name,dirs,verb,flags,subname)
  91.  * NamedMakeSubdirs        (name,dirs)
  92.  * MakeSubdirs            (dirs)
  93.  * DependSubdirs        (dirs)
  94.  * ForceSubdirs            (dirs)
  95.  * InstallSubdirs        (dirs)
  96.  * InstallManSubdirs        (dirs)
  97.  * IncludesSubdirs        (dirs)
  98.  * NamedCleanSubdirs        (name,dirs)
  99.  * CleanSubdirs            (dirs)
  100.  * NamedTagSubdirs        (name,dirs)
  101.  * TagSubdirs            (dirs)
  102.  * MakeLintSubdirs        (dirs,target,subtarget)
  103.  * LintSubdirs            (dirs)
  104.  * MakeLintLibSubdirs        (dirs)
  105.  * MakeMakeSubdirs        (dirs,target)
  106.  * MakeNsubdirMakefiles        ()
  107.  * MakefileSubdirs        (dirs)
  108.  * CppScriptTarget        (dst,src,defs,deplist)
  109.  * MakeScriptFromCpp        (name,defs)
  110.  * CppFileTarget        (dst,src,defs,deplist)
  111.  * MakeDirectories        (step,dirs)
  112.  * MakeFontsDir            (deplist)
  113.  * MakeFonts            ()
  114.  * InstallFontObjs        (objs,dest)
  115.  * InstallFonts            (dest)
  116.  * InstallFontAliases        (dest)
  117.  * FontSrc            (basename)
  118.  * FontBaseObj            (basename)
  119.  * FontBaseObj            (basename)
  120.  * InstallFontScale        (dest)
  121.  * FontSrc            (basename)
  122.  * FontBaseObj            (basename)
  123.  * FontBaseObj            (basename)
  124.  * UncompressedFontTarget    (basename)
  125.  * UncompressedFontTarget    (basename)
  126.  * CompressedFontTarget        (basename)
  127.  * FontTarget            (basename)
  128.  * FontObj            (basename)
  129.  * FontTarget            (basename)
  130.  * FontObj            (basename)
  131.  * AllTarget            (depends)
  132.  * LexTarget            (name)
  133.  * YaccTarget            (name)
  134.  *
  135.  *
  136.  * The following are in Imake.tmpl:
  137.  *
  138.  * Concat            (a,b)
  139.  * Concat3            (a,b,c)
  140.  * 
  141.  *
  142.  * The following are in specific <os>Lib.rules:
  143.  *
  144.  * SharedLibraryTarget        (libname,rev,solist,down,up)
  145.  * SharedLibraryDataTarget    (libname,rev,salist)
  146.  * InstallSharedLibrary        (libname,rev,dest)
  147.  * InstallSharedLibraryData    (libname,rev,dest)
  148.  * 
  149.  */
  150.  
  151. #define NullParameter
  152.  
  153. /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
  154. #ifndef DirFailPrefix
  155. #define DirFailPrefix
  156. #endif
  157.  
  158. /*
  159.  * SaberProgramTarget - generate rules to make Saber-C read in sources and
  160.  * objects.
  161.  */
  162. #ifndef SaberProgramTarget
  163. #if HasSaberC
  164. #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs)    @@\
  165. Concat(saber_,program):: srclist                    @@\
  166.     XCOMM load $(ALLDEFINES) srclist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs @@\
  167.                                     @@\
  168. Concat(osaber_,program):: objlist                    @@\
  169.     XCOMM load $(ALLDEFINES) objlist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs
  170.  
  171. #else
  172. #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs) /**/
  173. #endif
  174. #endif
  175.  
  176. #ifndef RemoveTargetProgram
  177. #if RemoveTargetProgramByMoving
  178. #define RemoveTargetProgram(program) \
  179. if [ -f program ]; then $(RM) Concat(program,~); $(MV) program Concat(program,~); fi
  180. #else
  181. #define RemoveTargetProgram(program) $(RM) program
  182. #endif
  183. #endif
  184.  
  185. #ifndef MakeDir
  186. #define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then set +x; \    @@\
  187.         else (set -x; $(MKDIRHIER) dir); fi
  188. #endif
  189.  
  190. #ifndef BuildIncludes
  191. #define BuildIncludes(srclist,dstsubdir,dstupdir)            @@\
  192. includes::                                @@\
  193.     MakeDir($(BUILDINCDIR)/dstsubdir)                @@\
  194.     @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \    @@\
  195.         $(RM) $$i; \                        @@\
  196.         $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \    @@\
  197.     done)
  198. #endif /* BuildIncludes */
  199.  
  200. /*
  201.  * NormalProgramTarget - generate rules to compile and link the indicated 
  202.  * program; since it does not use any default object files, it may be used for
  203.  * multiple programs in the same Imakefile.
  204.  */
  205. #ifndef NormalProgramTarget
  206. #define    NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)    @@\
  207. program: objects deplibs                        @@\
  208.     RemoveTargetProgram($@)                        @@\
  209.     $(CC) -o $@ objects $(LDOPTIONS) locallibs $(LDLIBS) syslibs $(EXTRA_LOAD_FLAGS) @@\
  210.                                     @@\
  211. clean::                                    @@\
  212.     $(RM) program
  213. #endif /* NormalProgramTarget */
  214.  
  215.  
  216. #ifndef SetUIDProgramTarget
  217. #define SetUIDProgramTarget NormalProgramTarget
  218. #endif
  219.  
  220.  
  221. /*
  222.  * SingleProgramTarget - obsolete version of NormalProgramTarget that does
  223.  * not have deplibs.
  224.  */
  225. #ifndef SingleProgramTarget
  226. #define    SingleProgramTarget(program,objects,locallibs,syslibs)        @@\
  227. NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
  228. #endif /* SingleProgramTarget */
  229.  
  230. /*
  231.  * SimpleProgramTarget - generate rules for compiling and linking programs
  232.  * that only have one C source file.  It should only be used in Imakefiles 
  233.  * that describe a single program.
  234.  */
  235. #ifndef SimpleProgramTarget
  236. #define    SimpleProgramTarget(program)                    @@\
  237.            OBJS = program.o                        @@\
  238.            SRCS = program.c                        @@\
  239.                                     @@\
  240. ComplexProgramTarget(program)
  241. #endif /* SimpleProgramTarget */
  242.  
  243. #ifndef SimpleProgramTarget_1
  244. #define    SimpleProgramTarget_1(program)                    @@\
  245.            OBJS1 = program.o                        @@\
  246.            SRCS1 = program.c                        @@\
  247.                                     @@\
  248. ComplexProgramTarget_1(program, $(LOCAL_LIBRARIES), $(SYS_LIBRARIES))
  249. #endif /* SimpleProgramTarget_1 */
  250.  
  251.  
  252. #ifndef SimpleProgramTarget_2
  253. #define    SimpleProgramTarget_2(program)                    @@\
  254.            OBJS2 = program.o                        @@\
  255.            SRCS2 = program.c                        @@\
  256.                                     @@\
  257. ComplexProgramTarget_2(program, $(LOCAL_LIBRARIES), $(SYS_LIBRARIES))
  258. #endif /* SimpleProgramTarget_2 */
  259.  
  260.  
  261. #ifndef SimpleProgramTarget_3
  262. #define    SimpleProgramTarget_3(program)                    @@\
  263.            OBJS3 = program.o                        @@\
  264.            SRCS3 = program.c                        @@\
  265.                                     @@\
  266. ComplexProgramTarget_3(program, $(LOCAL_LIBRARIES), $(SYS_LIBRARIES))
  267. #endif /* SimpleProgramTarget_3 */
  268.  
  269.  
  270. #ifndef SimpleProgramTarget_4
  271. #define    SimpleProgramTarget_4(program)                    @@\
  272.            OBJS4 = program.o                        @@\
  273.            SRCS4 = program.c                        @@\
  274.                                     @@\
  275. ComplexProgramTarget_4(program, $(LOCAL_LIBRARIES), $(SYS_LIBRARIES))
  276. #endif /* SimpleProgramTarget_4 */
  277.  
  278.  
  279. #ifndef SimpleProgramTarget_5
  280. #define    SimpleProgramTarget_5(program)                    @@\
  281.            OBJS5 = program.o                        @@\
  282.            SRCS5 = program.c                        @@\
  283.                                     @@\
  284. ComplexProgramTarget_5(program, $(LOCAL_LIBRARIES), $(SYS_LIBRARIES))
  285. #endif /* SimpleProgramTarget_5 */
  286.  
  287.  
  288.  
  289. /*
  290.  * ComplexProgramTarget - generate rules for compiling and linking the 
  291.  * program specified by $(OBJS) and $(SRCS), installing the program and its
  292.  * man page, and generating dependencies.  It should only be used in 
  293.  * Imakefiles that describe a single program.
  294.  */
  295. #ifndef ComplexProgramTarget
  296. #define    ComplexProgramTarget(program)                    @@\
  297.         PROGRAM = program                        @@\
  298.                                     @@\
  299. AllTarget(program)                            @@\
  300.                                     @@\
  301. program: $(OBJS) $(DEPLIBS)                        @@\
  302.     RemoveTargetProgram($@)                        @@\
  303.     $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
  304.                                     @@\
  305. SaberProgramTarget(program,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES),NullParameter) @@\
  306.                                     @@\
  307. DependTarget()                                @@\
  308. LintTarget()                                @@\
  309.                                     @@\
  310. clean::                                    @@\
  311.     $(RM) $(PROGRAM)
  312. #endif /* ComplexProgramTarget */
  313.  
  314.  
  315. /*
  316.  * ComplexProgramTarget_1 - generate rules for compiling and linking the
  317.  * program specified by $(OBJS1) and $(SRCS1), installing the program and its
  318.  * man page, and generating dependencies for it and any programs described
  319.  * by $(SRCS2) and $(SRCS3).  It should be used to build the primary 
  320.  * program in Imakefiles that describe multiple programs.
  321.  */
  322. #ifndef ComplexProgramTarget_1
  323. #define    ComplexProgramTarget_1(program,locallib,syslib)            @@\
  324.             OBJS = $(OBJS1) $(OBJS2) $(OBJS3)                @@\
  325.             SRCS = $(SRCS1) $(SRCS2) $(SRCS3)                @@\
  326.                                     @@\
  327. AllTarget($(PROGRAMS))                            @@\
  328.                                     @@\
  329. program: $(OBJS1) $(DEPLIBS1)                        @@\
  330.     RemoveTargetProgram($@)                        @@\
  331.     $(CC) -o $@ $(LDOPTIONS) $(OBJS1) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  332.                                     @@\
  333.                                     @@\
  334. SaberProgramTarget(program,$(SRCS1),$(OBJS1),locallib,syslib)        @@\
  335.                                     @@\
  336. DependTarget()                                @@\
  337. LintTarget()                                @@\
  338.                                     @@\
  339. clean::                                    @@\
  340.     $(RM) $(PROGRAMS)
  341. #endif /* ComplexProgramTarget_1 */
  342.  
  343.  
  344. /*
  345.  * ComplexProgramTarget_2 - generate rules for compiling and linking the
  346.  * program specified by $(OBJS2) and $(SRCS2) and installing the program and
  347.  * man page.  It should be used to build the second program in Imakefiles 
  348.  * describing more than one program.
  349.  */
  350. #ifndef ComplexProgramTarget_2
  351. #define    ComplexProgramTarget_2(program,locallib,syslib)            @@\
  352. program: $(OBJS2) $(DEPLIBS2)                        @@\
  353.     RemoveTargetProgram($@)                        @@\
  354.     $(CC) -o $@ $(LDOPTIONS) $(OBJS2) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  355.                                     @@\
  356. SaberProgramTarget(program,$(SRCS2),$(OBJS2),locallib,syslib)        @@\
  357.  
  358. #endif /* ComplexProgramTarget_2 */
  359.  
  360.  
  361. /*
  362.  * ComplexProgramTarget_3 - generate rules for compiling and linking the
  363.  * program specified by $(OBJS3) and $(SRCS3) and installing the program and
  364.  * man page.  It should be used to build the third program in Imakefiles 
  365.  * describing more than one program.
  366.  */
  367. #ifndef ComplexProgramTarget_3
  368. #define    ComplexProgramTarget_3(program,locallib,syslib)            @@\
  369. program: $(OBJS3) $(DEPLIBS3)                        @@\
  370.     RemoveTargetProgram($@)                        @@\
  371.     $(CC) -o $@ $(LDOPTIONS) $(OBJS3) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  372.                                     @@\
  373. SaberProgramTarget(program,$(SRCS3),$(OBJS3),locallib,syslib)        @@\
  374.  
  375. #endif /* ComplexProgramTarget_3 */
  376.  
  377.  
  378. /*
  379.  * ComplexProgramTarget_4 - generate rules for compiling and linking the
  380.  * program specified by $(OBJS4) and $(SRCS4) and installing the program and
  381.  * man page.  It should be used to build the third program in Imakefiles 
  382.  * describing more than one program.
  383.  */
  384. #ifndef ComplexProgramTarget_4
  385. #define    ComplexProgramTarget_4(program,locallib,syslib)            @@\
  386. program: $(OBJS4) $(DEPLIBS4)                        @@\
  387.     RemoveTargetProgram($@)                        @@\
  388.     $(CC) -o $@ $(LDOPTIONS) $(OBJS4) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  389.                                     @@\
  390. SaberProgramTarget(program,$(SRCS4),$(OBJS4),locallib,syslib)        @@\
  391.  
  392. #endif /* ComplexProgramTarget_4 */
  393.  
  394.  
  395. /*
  396.  * ComplexProgramTarget_5 - generate rules for compiling and linking the
  397.  * program specified by $(OBJS5) and $(SRCS5) and installing the program and
  398.  * man page.  It should be used to build the third program in Imakefiles 
  399.  * describing more than one program.
  400.  */
  401. #ifndef ComplexProgramTarget_5
  402. #define    ComplexProgramTarget_5(program,locallib,syslib)            @@\
  403. program: $(OBJS5) $(DEPLIBS5)                        @@\
  404.     RemoveTargetProgram($@)                        @@\
  405.     $(CC) -o $@ $(LDOPTIONS) $(OBJS5) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  406.                                     @@\
  407. SaberProgramTarget(program,$(SRCS5),$(OBJS5),locallib,syslib)        @@\
  408.  
  409. #endif /* ComplexProgramTarget_5 */
  410.  
  411.  
  412. /*
  413.  * ServerTarget - generate rules to compile, link, and relink an X server.
  414.  */
  415. #ifndef ServerTarget
  416. #define    ServerTarget(server,subdirs,objects,libs,syslibs)        @@\
  417. server: subdirs objects libs                        @@\
  418.     -@if [ -f server ]; then set -x; \                @@\
  419.         $(MV) server server.bak; else exit 0; fi        @@\
  420.     $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS) @@\
  421.                                     @@\
  422. Concat(load,server):                            @@\
  423.     -@if [ -f server ]; then set -x; \                @@\
  424.         $(MV) server server.bak; else exit 0; fi        @@\
  425.     $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS)
  426. #endif /* ServerTarget */
  427.  
  428.  
  429. #if DoRanlibCmd
  430. #define RanLibrary(args) $(RANLIB) args
  431. #else
  432. #define RanLibrary(args) /**/
  433. #endif
  434.  
  435. /*
  436.  * InstallLibrary - generate rules to install the indicated library.
  437.  */
  438. #ifndef InstallLibrary
  439. #define    InstallLibrary(libname,dest)                    @@\
  440. install:: Concat(lib,libname.a)                        @@\
  441.     MakeDir($(DESTDIR)dest)                        @@\
  442.     $(INSTALL) -c $(INSTLIBFLAGS) Concat(lib,libname.a) $(DESTDIR)dest @@\
  443.     RanLibrary($(RANLIBINSTFLAGS) Concat($(DESTDIR)dest/lib,libname.a))
  444. #endif /* InstallLibrary */
  445.  
  446. /*
  447.  * MergeIntoInstalledLibrary - generate rules to merge one library into another
  448.  */
  449. #ifndef MergeIntoInstalledLibrary
  450. #define MergeIntoInstalledLibrary(tolib,fromlib)            @@\
  451. install::  fromlib                            @@\
  452.     $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
  453. #endif /* MergeIntoInstalledLibrary */
  454.  
  455. /*
  456.  * InstallLibraryAlias - generate rules to create a link from one library name
  457.  * to another for the purposes of aliasing.
  458.  */
  459. #ifndef InstallLibraryAlias
  460. #define    InstallLibraryAlias(libname,alias,dest)                @@\
  461. install::                                @@\
  462.     -(cd $(DESTDIR)dest; \                        @@\
  463.         $(RM) Concat(lib,alias.a); \                @@\
  464.         $(LN) Concat(lib,libname.a) Concat(lib,alias.a))
  465. #endif /* InstallLibraryAlias */
  466.  
  467.  
  468. /*
  469.  * InstallLintLibrary - generate rules to install the indicated lint library.
  470.  */
  471. #ifndef InstallLintLibrary
  472. #define    InstallLintLibrary(libname,dest)                @@\
  473. install.ln:: Concat(llib-l,libname.ln)                    @@\
  474.     MakeDir($(DESTDIR)dest)                        @@\
  475.     $(INSTALL) -c $(INSTLIBFLAGS) Concat(llib-l,libname.ln) $(DESTDIR)dest
  476. #endif /* InstallLintLibrary */
  477.  
  478.  
  479. /*
  480.  * InstallManPageLong - generate rules to install the indicated manual page,
  481.  * giving it an alternate name.  This is used for installing man pages whose
  482.  * base name without the .man suffix would normally be longer than 8 characters
  483.  * (the limit for using source code control systems on files systems with 
  484.  * short file names).
  485.  */
  486. #ifndef InstallManPageLong
  487. #define    InstallManPageLong(file,destdir,dest)                @@\
  488. install.man:: file.man                            @@\
  489.     MakeDir($(DESTDIR)destdir)                    @@\
  490.     $(INSTALL) -c $(INSTMANFLAGS) file.man $(DESTDIR)destdir/dest.$(MANSUFFIX)
  491. #endif /* InstallManPageLong */
  492.  
  493.  
  494. /*
  495.  * InstallManPage - generate rules to install the indicated manual page.
  496.  */
  497. #ifndef InstallManPage
  498. #define    InstallManPage(file,destdir)                    @@\
  499. InstallManPageLong(file,destdir,file)
  500. #endif /* InstallManPage */
  501.  
  502.  
  503. /*
  504.  * InstallManPageAliases - generate rules to install manual page aliases.
  505.  */
  506. #ifndef InstallManPageAliases
  507. #define    InstallManPageAliases(file,destdir,aliases)            @@\
  508. install.man::                                @@\
  509.     @(TMP=/tmp/tmp.$$$$; \                        @@\
  510.     $(RM) $${TMP}; \                        @@\
  511.     echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \    @@\
  512.     for i in aliases; do (set -x; \                    @@\
  513.     $(INSTALL) -c $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\
  514.     done; \                                @@\
  515.     $(RM) $${TMP})
  516. #endif /* InstallManPageAliases */
  517.  
  518.  
  519. /*
  520.  * InstallNamedNonExec - generate rules to install a data file
  521.  */
  522. #ifndef InstallNamedNonExec
  523. #define    InstallNamedNonExec(srcname,dstname,dest)            @@\
  524. install:: srcname                            @@\
  525.     MakeDir($(DESTDIR)dest)                        @@\
  526.     $(INSTALL) -c $(INSTDATFLAGS) srcname $(DESTDIR)dest/dstname
  527. #endif /* InstallNamedNonExec */
  528.  
  529.  
  530. /*
  531.  * InstallNonExecFile - generate rules to install a data file
  532.  */
  533. #ifndef InstallNonExecFile
  534. #define    InstallNonExecFile(file,dest)                    @@\
  535. install:: file                                @@\
  536.     MakeDir($(DESTDIR)dest)                        @@\
  537.     $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest
  538. #endif /* InstallNonExecFile */
  539.  
  540.  
  541. /*
  542.  * InstallNonExec - generate rules to install a data file, but does not
  543.  * try to create the destination directory (deprecated)
  544.  */
  545. #ifndef InstallNonExec
  546. #define    InstallNonExec(file,dest)                    @@\
  547. install:: file                                @@\
  548.     $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest
  549. #endif /* InstallNonExec */
  550.  
  551.  
  552. /*
  553.  * InstallProgramWithFlags - generate rules to install an executable program
  554.  * using given install flags.
  555.  */
  556. #ifndef InstallProgramWithFlags
  557. #define InstallProgramWithFlags(program,dest,flags)            @@\
  558. install:: program                            @@\
  559.     MakeDir($(DESTDIR)dest)                        @@\
  560.     $(INSTALL) -c $(INSTPGMFLAGS) flags program $(DESTDIR)dest      @@\
  561.     strip $(DESTDIR)dest/program
  562. #endif /* InstallProgramWithFlags */
  563.  
  564.  
  565. /*
  566.  * InstallProgram - generate rules to install an executable program using any
  567.  * special install flags set in $(INSTALLFLAGS).
  568.  */
  569. #ifndef InstallProgram
  570. #define    InstallProgram(program,dest)                    @@\
  571. InstallProgramWithFlags(program,dest,NullParameter)
  572. #endif /* InstallProgram */
  573.  
  574.  
  575.  
  576. /*
  577.  * InstallScript - install a shell script.
  578.  */
  579. #ifndef InstallScript
  580. #define    InstallScript(program,dest)                    @@\
  581. install:: program.script                        @@\
  582.     MakeDir($(DESTDIR)dest)                        @@\
  583.     $(INSTALL) -c $(INSTBINFLAGS) program.script $(DESTDIR)dest/program
  584. #endif /* InstallScript */
  585.  
  586.  
  587. /*
  588.  * InstallNamedProg - install a program with renaming and no stripping.
  589.  */
  590. #ifndef InstallNamedProg
  591. #define    InstallNamedProg(srcname,dstname,dest)                @@\
  592. install:: srcname                            @@\
  593.     MakeDir($(DESTDIR)dest)                        @@\
  594.     $(INSTALL) -c $(INSTBINFLAGS) srcname $(DESTDIR)dest/dstname
  595. #endif /* InstallNamedProg */
  596.  
  597.  
  598. /*
  599.  * LinkFileList - link a list of list of files from one place to another
  600.  */
  601. #ifndef LinkFileList
  602. #define LinkFileList(step,list,dir,sub)                    @@\
  603. step:: list                                @@\
  604.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@\
  605.     echo "    cd" dir; cd dir; \                    @@\
  606.     for i in list; do (set -x; $(RM) $$i; $(LN) sub/$$i .); done
  607. #endif
  608.  
  609.  
  610. /*
  611.  * InstallMultipleDestFlags - generate rules to install multiple files at
  612.  * once during a particular step in the build using a specific set of install 
  613.  * flags.
  614.  */
  615. #ifndef InstallMultipleDestFlags
  616. #define InstallMultipleDestFlags(step,list,dest,flags)            @@\
  617. step:: list                                @@\
  618.     MakeDir($(DESTDIR)dest)                        @@\
  619.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@\
  620.     for i in list; do \                        @@\
  621.         (set -x; $(INSTALL) -c flags $$i $(DESTDIR)dest); \    @@\
  622.     done
  623. #endif /* InstallMultipleDestFlags */
  624.  
  625. #ifndef InstallIncludes
  626. #define InstallIncludes(srclist,dstsubdir)                @@\
  627. install:: srclist                            @@\
  628.     MakeDir($(DESTDIR)/include/dstsubdir)                @@\
  629.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@\
  630.     for i in srclist; do \                        @@\
  631.         (set -x; $(INSTALL) -c -m 0644 $$i $(DESTDIR)include/dstsubdir) \@@\
  632.     done
  633. #endif /* InstallIncludes */
  634.  
  635.  
  636. /*
  637.  * InstallMultipleDest - generate rules to install multiple files at once
  638.  * during a particular step in the build using any install flags set in 
  639.  * $(INSTALLFLAGS).
  640.  */
  641. #ifndef InstallMultipleDest
  642. #define InstallMultipleDest(step,list,dest)                @@\
  643. InstallMultipleDestFlags(step,list,dest,$(INSTALLFLAGS))
  644. #endif /* InstallMultipleDest */
  645.  
  646. /*
  647.  * InstallMultiple - generate rules to install multiple files at once 
  648.  * during the install step of the build using any install flags set in 
  649.  * $(INSTALLFLAGS).
  650.  */
  651. #ifndef InstallMultiple
  652. #define    InstallMultiple(list,dest)                    @@\
  653. InstallMultipleDest(install,list,dest)
  654. #endif /* InstallMultiple */
  655.  
  656.  
  657. /*
  658.  * InstallMultipleFlags - generate rules to install multiple files at once
  659.  * during the install step of the build using the given install flags.
  660.  */
  661. #ifndef InstallMultipleFlags
  662. #define InstallMultipleFlags(list,dest,flags)                @@\
  663. InstallMultipleDestFlags(install,list,dest,flags)
  664. #endif /* InstallMultipleFlags */
  665.  
  666.  
  667. /*
  668.  * InstallMultipleMan - generate rules to install a variety of manual pages
  669.  * during the install.man step of the build.
  670.  */
  671. #ifndef InstallMultipleMan
  672. #define InstallMultipleMan(list,dest)                    @@\
  673. InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
  674. #endif /* InstallMultipleMan */
  675.  
  676.  
  677. /*
  678.  * InstallAppDefaults - generate rules to install appliation default files 
  679.  * if the InstallAppDefFiles configuration parameter is set.
  680.  */
  681. #ifndef InstallAppDefaults
  682. #if InstallAppDefFiles
  683. #define    InstallAppDefaults(class)                    @@\
  684. install:: class.ad                            @@\
  685.     MakeDir($(DESTDIR)$(XAPPLOADDIR))                @@\
  686.     $(INSTALL) -c $(INSTAPPFLAGS) class.ad $(DESTDIR)$(XAPPLOADDIR)/class
  687. #else
  688. #define    InstallAppDefaults(class)
  689. #endif /* InstallAppDefFiles */
  690. #endif /* InstallAppDefaults */
  691.  
  692. /*
  693.  * InstallAppDefaultsLong - generate rules to install appliation default files 
  694.  * if the InstallAppDefFiles configuration parameter is set.
  695.  */
  696. #ifndef InstallAppDefaultsLong
  697. #if InstallAppDefFiles
  698. #define    InstallAppDefaultsLong(file,class)                @@\
  699. install:: file.ad                            @@\
  700.     MakeDir($(DESTDIR)$(XAPPLOADDIR))                @@\
  701.     $(INSTALL) -c $(INSTAPPFLAGS) file.ad $(DESTDIR)$(XAPPLOADDIR)/class
  702. #else
  703. #define    InstallAppDefaultsLong(file,class)
  704. #endif /* InstallAppDefFiles */
  705. #endif /* InstallAppDefaultsLong */
  706.  
  707.  
  708.  
  709.  
  710. /*
  711.  * DependDependency - generate rules to build the makedepend program if 
  712.  * this Imakefile is within the source tree.
  713.  */
  714. #ifndef DependDependency
  715. #ifdef UseInstalled
  716. #define DependDependency() /**/
  717. #else
  718. #define DependDependency()                         @@\
  719. depend:: $(DEPEND)                            @@\
  720.                                     @@\
  721. $(DEPEND):                                @@\
  722.     @echo "checking $@ over in $(DEPENDSRC) first..."; \        @@\
  723.     cd $(DEPENDSRC); $(MAKE); \                    @@\
  724.     echo "okay, continuing in $(CURRENT_DIR)"
  725.  
  726. #endif /* UseInstalled */
  727. #endif /* DependDependency */
  728.  
  729.  
  730. /*
  731.  * DependTarget - generate rules to compute dependencies for all files listed
  732.  * in $(SRCS).
  733.  */
  734. #ifndef DependTarget
  735. #define    DependTarget()                            @@\
  736. DependDependency()                            @@\
  737.                                     @@\
  738. depend::                                @@\
  739.     $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  740. #endif /* DependTarget */
  741.  
  742.  
  743. /*
  744.  * DependTarget3 - generate rules to compute dependencies for all files given.
  745.  */
  746. #ifndef DependTarget3
  747. #define    DependTarget3(srcs1,srcs2,srcs3)                @@\
  748. DependDependency()                            @@\
  749.                                     @@\
  750. depend::                                @@\
  751.     $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs1    @@\
  752.     $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs2    @@\
  753.     $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs3
  754. #endif /* DependTarget3 */
  755.  
  756.  
  757. /*
  758.  * CleanTarget - generate rules to remove any garbage files; the #* is here
  759.  * instead of in the definition of RM_CMD because System V will treat the 
  760.  * pound sign in the RM_CMD variable as a comment.
  761.  */
  762. #ifndef CleanTarget
  763. #define    CleanTarget()                            @@\
  764. clean::                                    @@\
  765.     $(RM_CMD) "#"*                            @@\
  766.     $(RM) -r ptrepository
  767. #endif /* CleanTarget */
  768.  
  769.  
  770. /*
  771.  * TagsTarget - generate rules to compute tags files for C source code.
  772.  */
  773. #ifndef TagsTarget
  774. #define    TagsTarget()                            @@\
  775. tags::                                    @@\
  776.     $(TAGS) -w *.[ch]                        @@\
  777.     $(TAGS) -xw *.[ch] > TAGS
  778. #endif /* TagsTarget */
  779.  
  780.  
  781. /*
  782.  * ImakeDependency - generate rules to compile imake if this Imakefile is
  783.  * within the source tree.
  784.  */
  785. #ifndef ImakeDependency
  786. #ifdef UseInstalled
  787. #define ImakeDependency(target) /**/
  788. #else
  789. #define ImakeDependency(target)                        @@\
  790. target:: $(IMAKE)                            @@\
  791.                                     @@\
  792. $(IMAKE):                                @@\
  793.     @(cd $(IMAKESRC); if [ -f Makefile ]; then \            @@\
  794.     echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \    @@\
  795.     echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \    @@\
  796.     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \    @@\
  797.     echo "okay, continuing in $(CURRENT_DIR)")
  798. #endif /* UseInstalled */
  799. #endif /* ImakeDependency */
  800.  
  801.  
  802. /*
  803.  * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
  804.  * and any special imake flags.  This is generally done automatically by the
  805.  * template or by any special Imakefiles.  The first argument exists just
  806.  * because imakeflags is usually empty and some preprocessors will complain
  807.  * if an empty argument is passed as the sole argument to a macro.
  808.  */
  809. #ifndef BuildMakefileTarget
  810. #define    BuildMakefileTarget(notused,imakeflags)                @@\
  811. ImakeDependency(Makefile)                        @@\
  812.                                     @@\
  813. Makefile::                                 @@\
  814.     -@if [ -f Makefile ]; then set -x; \                @@\
  815.         $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \    @@\
  816.     else exit 0; fi                            @@\
  817.     $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
  818.  
  819. #endif /* BuildMakefileTarget */
  820.  
  821.  
  822. /*
  823.  * MakefileTarget - generate rules to build a normal Makefile.
  824.  */
  825. #ifndef MakefileTarget
  826. #define MakefileTarget()                        @@\
  827. BuildMakefileTarget(Imakefile,NullParameter)
  828. #endif /* MakefileTarget */
  829.  
  830.  
  831. /*
  832.  * LibMkdir - helper for creating library object subdirectories
  833.  */
  834. #ifndef LibMkdir
  835. #define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
  836. #endif
  837.  
  838. /*
  839.  * LibCleanDir - helper for cleaning library object subdirectories
  840.  */
  841. #ifndef LibCleanDir
  842. #define LibCleanDir(dir) -@if [ -d dir ]; then \            @@\
  843.         (set -x; cd dir; $(RM) *.o); else exit 0; fi
  844. #endif
  845.  
  846. /*
  847.  * ObjectCompile - compile fragment for a normal object file
  848.  */
  849. #ifndef ObjectCompile
  850. #define ObjectCompile(options) $(RM) $@                    @@\
  851.     $(CC) -c $(CFLAGS) options $*.c
  852. #endif
  853.  
  854. /*
  855.  * NormalLibObjCompile - compile fragment for a normal library object file
  856.  */
  857. #ifndef NormalLibObjCompile
  858. #define NormalLibObjCompile(options) ObjectCompile(options)
  859. #endif
  860.  
  861. /*
  862.  * NormalSharedLibObjCompile - compile fragment for shared object when
  863.  * a normal library is not being built
  864.  */
  865. #ifndef NormalSharedLibObjCompile
  866. #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
  867. #endif
  868.  
  869. /*
  870.  * LibObjCompile - compile fragment for shared/profiled/debugged objects
  871.  */
  872. #ifndef LibObjCompile
  873. #define LibObjCompile(dir,options) $(RM) $@ dir/$@            @@\
  874.     $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c        @@\
  875.     $(MV) $@ dir/$@
  876. #endif
  877.  
  878. /*
  879.  * DebuggedLibObjCompile - compile fragment for debugged objects
  880.  */
  881. #ifndef DebuggedLibObjCompile
  882. #define DebuggedLibObjCompile(options) LibObjCompile(debugger,-g options)
  883. #endif
  884.  
  885. /*
  886.  * ProfiledLibObjCompile - compile fragment for profiled objects
  887.  */
  888. #ifndef ProfiledLibObjCompile
  889. #define ProfiledLibObjCompile(options) LibObjCompile(profiled,-pg options)
  890. #endif
  891.  
  892. /*
  893.  * SharedLibObjCompile - compile fragment for shared objects
  894.  */
  895. #ifndef SharedLibObjCompile
  896. #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS))
  897. #endif
  898.  
  899. /*
  900.  * NormalLibraryObjectRule - for simple libraries
  901.  */
  902. #ifndef NormalLibraryObjectRule
  903. #define    NormalLibraryObjectRule()                    @@\
  904. .c.o:                                    @@\
  905.     ObjectCompile($(_NOOP_))
  906. #endif /* NormalLibraryObjectRule */
  907.  
  908.  
  909. #ifndef NormalFortranObjectRule
  910. #define NormalFortranObjectRule()                    @@\
  911. .f.o:                                    @@\
  912.     $(RM) $@                            @@\
  913.     $(FC) -c $(FCFLAGS) $*.f
  914. #endif
  915.  
  916. #ifndef ObjectFromSpecialSource
  917. #define ObjectFromSpecialSource(dst,src,flags)                @@\
  918. dst.c:  src.c                                @@\
  919.     $(RM) $@                            @@\
  920.     $(LN) $? $@                            @@\
  921.                                     @@\
  922. dst.o:  dst.c                                @@\
  923.     ObjectCompile(flags)                        @@\
  924.                                     @@\
  925. depend::  dst.c                                @@\
  926.                                     @@\
  927. clean::                                    @@\
  928.     $(RM) dst.c
  929. #endif /* ObjectFromSpecialSource */
  930.  
  931. /*
  932.  * SpecialObjectRule - generate rules to compile a file with special flags.
  933.  */
  934. #ifndef SpecialObjectRule
  935. #define SpecialObjectRule(objs,depends,options)                @@\
  936. objs:    depends                                @@\
  937.     ObjectCompile(options)
  938. #endif /* SpecialObjectRule */
  939.  
  940.  
  941. /*
  942.  * NormalLibraryTarget - generate rules to create a library.
  943.  */
  944. #ifndef NormalLibraryTarget
  945. #define    NormalLibraryTarget(libname,objlist)                @@\
  946. AllTarget(Concat(lib,libname.a))                    @@\
  947.                                     @@\
  948. Concat(lib,libname.a):: objlist                        @@\
  949.     $(RM) $@                            @@\
  950.     $(AR) $@ objlist                        @@\
  951.     RanLibrary($@)
  952. #endif /* NormalLibraryTarget */
  953.  
  954.  
  955. /*
  956.  * NormalLibraryTarget2 - generate rules to create a library in two steps.
  957.  * This is used to create libraries with large numbers of files.
  958.  */
  959. #ifndef NormalLibraryTarget2
  960. #define    NormalLibraryTarget2(libname,objlist1,objlist2)            @@\
  961. AllTarget(Concat(lib,libname.a))                    @@\
  962.                                     @@\
  963. Concat(lib,libname.a): objlist1 objlist2                @@\
  964.     $(RM) $@                            @@\
  965.     $(AR) $@ objlist1                        @@\
  966.     $(AR) $@ objlist2                        @@\
  967.     RanLibrary($@)
  968. #endif /* NormalLibraryTarget2 */
  969.  
  970.  
  971. /*
  972.  * NormalLibraryTarget3 - generate rules to create a library in three steps.
  973.  * This is used to create libraries with very large numbers of files.
  974.  */
  975. #ifndef NormalLibraryTarget3
  976. #define    NormalLibraryTarget3(libname,objlist1,objlist2,objlist3)    @@\
  977. AllTarget(Concat(lib,libname.a))                    @@\
  978.                                     @@\
  979. Concat(lib,libname.a): objlist1 objlist2 objlist3            @@\
  980.     $(RM) $@                            @@\
  981.     $(AR) $@ objlist1                        @@\
  982.     $(AR) $@ objlist2                        @@\
  983.     $(AR) $@ objlist3                        @@\
  984.     RanLibrary($@)
  985. #endif /* NormalLibraryTarget3 */
  986.  
  987.  
  988. /*
  989.  * NormalDepLibraryTarget - generate rules to create a library.
  990.  */
  991. #ifndef NormalDepLibraryTarget
  992. #define    NormalDepLibraryTarget(libname,deplist,objlist)            @@\
  993. AllTarget(Concat(lib,libname.a))                    @@\
  994.                                     @@\
  995. Concat(lib,libname.a): deplist                        @@\
  996.     $(RM) $@                            @@\
  997.     $(AR) $@ objlist                        @@\
  998.     RanLibrary($@)
  999. #endif /* NormalDepLibraryTarget */
  1000.  
  1001.  
  1002. /*
  1003.  * SubdirLibraryRule -
  1004.  */
  1005. #ifndef SubdirLibraryRule
  1006. #define    SubdirLibraryRule(objlist)                    @@\
  1007. all:: DONE                                @@\
  1008.                                     @@\
  1009. DONE: objlist                                @@\
  1010.     touch $@                            @@\
  1011.                                     @@\
  1012. clean::                                    @@\
  1013.     $(RM) DONE
  1014. #endif /* SubdirLibraryRule */
  1015.  
  1016.  
  1017. /*
  1018.  * ProfiledLibraryTarget - generate rules to create a profiled library.
  1019.  */
  1020. #ifndef ProfiledLibraryTarget
  1021. #define    ProfiledLibraryTarget(libname,objlist)                @@\
  1022. AllTarget(Concat3(lib,libname,_p.a))                    @@\
  1023.                                     @@\
  1024. Concat3(lib,libname,_p.a): objlist                    @@\
  1025.     $(RM) $@                            @@\
  1026.     cd profiled; $(AR) ../$@ objlist                @@\
  1027.     RanLibrary($@)
  1028.  
  1029. #endif /* ProfiledLibraryTarget */
  1030.  
  1031.  
  1032. /*
  1033.  * DebuggedLibraryTarget - generate rules to create a debuggable library.
  1034.  */
  1035. #ifndef DebuggedLibraryTarget
  1036. #define    DebuggedLibraryTarget(libname,objlist)                @@\
  1037. AllTarget(Concat3(lib,libname,_d.a))                    @@\
  1038.                                     @@\
  1039. Concat3(lib,libname,_d.a): objlist                    @@\
  1040.     $(RM) $@                            @@\
  1041.     cd debugger; $(AR) ../$@ objlist                @@\
  1042.     RanLibrary($@)
  1043.  
  1044. #endif /* DebuggedLibraryTarget */
  1045.  
  1046.  
  1047. /*
  1048.  * AliasedLibraryTarget - generate rules to link one library to another.
  1049.  */
  1050. #ifndef AliasedLibraryTarget
  1051. #define    AliasedLibraryTarget(libname,alias)                @@\
  1052. AllTarget(Concat(lib,alias.a))                        @@\
  1053.                                     @@\
  1054. Concat(lib,alias.a): Concat(lib,libname.a)                @@\
  1055.     $(RM) $@                            @@\
  1056.     $(LN) Concat(lib,libname.a) $@
  1057. #endif /* AliasedLibraryTarget */
  1058.  
  1059.  
  1060. /*
  1061.  * NormalRelocatableTarget - generate rules to produce a relocatable object
  1062.  * file instead of a library.  
  1063.  */
  1064. #ifndef NormalRelocatableTarget
  1065. #define    NormalRelocatableTarget(objname,objlist)            @@\
  1066. AllTarget(objname.o)                            @@\
  1067.                                     @@\
  1068. objname.o: objlist                            @@\
  1069.     $(RM) $@                            @@\
  1070.     $(LD) $(LDCOMBINEFLAGS) objlist -o $@
  1071. #endif /* NormalRelocatableTarget */
  1072.  
  1073.  
  1074. /*
  1075.  * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
  1076.  * object file instead of a library.
  1077.  */
  1078. #ifndef ProfiledRelocatableTarget
  1079. #define    ProfiledRelocatableTarget(objname,objlist)            @@\
  1080. AllTarget(Concat(objname,_p.o))                        @@\
  1081.                                     @@\
  1082. Concat(objname,_p.o): objlist                        @@\
  1083.     $(RM) $@                            @@\
  1084.     $(LD) -X -r objlist -o $@
  1085.  
  1086. #endif /* ProfiledRelocatableTarget */
  1087.  
  1088.  
  1089. /*
  1090.  * DebuggedRelocatableTarget - generate rules to produce a debuggable 
  1091.  * relocatable object file instead of a library.
  1092.  */
  1093. #ifndef DebuggedRelocatableTarget
  1094. #define    DebuggedRelocatableTarget(objname,objlist)            @@\
  1095. AllTarget(Concat(objname,_d.o))                        @@\
  1096.                                     @@\
  1097. Concat(objname,_d.o): objlist                        @@\
  1098.     $(RM) $@                            @@\
  1099.     $(LD) -X -r objlist -o $@
  1100.  
  1101. #endif /* DebuggedRelocatableTarget */
  1102.  
  1103.  
  1104. /*
  1105.  * LintLibraryTarget - generate rules to create a lint library.  Note that the
  1106.  * lint library is always forced to be newer than the library itself.
  1107.  */
  1108. #ifndef LintLibraryTarget
  1109. #define    LintLibraryTarget(libname,srclist)                @@\
  1110. lintlib:: Concat(llib-l,libname.ln)                    @@\
  1111.                                     @@\
  1112. Concat(llib-l,libname.ln): srclist                    @@\
  1113.     $(RM) $@                            @@\
  1114.     $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
  1115. #endif /* LintLibraryTarget */
  1116.  
  1117.  
  1118. /*
  1119.  * NormalLintTarget - generate rules to lint a set of sources.
  1120.  */
  1121. #ifndef NormalLintTarget
  1122. #define NormalLintTarget(srclist)                    @@\
  1123. lint:                                    @@\
  1124.     $(LINT) $(LINTFLAGS) srclist $(LINTLIBS)            @@\
  1125. lint1:                                    @@\
  1126.     $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  1127. #endif /* NormalLintTarget */
  1128.  
  1129.  
  1130. /*
  1131.  * LintTarget - generate rules to lint $(SRCS)
  1132.  */
  1133. #ifndef LintTarget
  1134. #define LintTarget()                            @@\
  1135. NormalLintTarget($(SRCS))
  1136. #endif
  1137.  
  1138.  
  1139. /*
  1140.  * LinkSourceFile - snag source file from some other directory
  1141.  */
  1142. #ifndef LinkSourceFile
  1143. #define LinkSourceFile(src,dir)                        @@\
  1144. src:  dir/src                                @@\
  1145.     $(RM) $@                            @@\
  1146.     $(LN) $? $@                            @@\
  1147. clean::                                 @@\
  1148.     $(RM) src                            @@\
  1149.  
  1150. #endif
  1151.  
  1152.  
  1153. /*
  1154.  * LinkFile - link a file
  1155.  */
  1156. #ifndef LinkFile
  1157. #define LinkFile(tofile,fromfile)                    @@\
  1158. tofile:: fromfile                            @@\
  1159.     $(RM) $@                            @@\
  1160.     $(LN) $? $@
  1161. #endif
  1162.  
  1163.  
  1164. #ifndef MakeSubincludesForBuild
  1165. #define MakeSubincludesForBuild(step,dir,srclist)            @@\
  1166. step::  dir srclist                            @@\
  1167.     @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@\
  1168.         set -x; cd dir; $(RM) $$list)                @@\
  1169.     @for i in srclist; do \                        @@\
  1170.         (set -x; cd dir; $(LN) ../$$i .); \            @@\
  1171.     done                                @@\
  1172.                                     @@\
  1173. dir::                                    @@\
  1174.     $(MKDIRHIER) dir                        @@\
  1175.                                     @@\
  1176. clean::                                    @@\
  1177.     @-(if [ -d dir ]; then \                    @@\
  1178.         list=`echo srclist | sed -e 's/[^ ]*\///g'`; \        @@\
  1179.         set -x; cd dir; $(RM) $$list; else exit 0; fi)
  1180. #endif
  1181.  
  1182.  
  1183. /*
  1184.  * NamedTargetSubdirs - recursively make a series of steps
  1185.  */
  1186. #ifndef NamedTargetSubdirs
  1187. #define NamedTargetSubdirs(name,dirs,verb,flags,subname)        @@\
  1188. name::                                    @@\
  1189.     @case '${MFLAGS}' in *[ik]*) set +e;; esac; \            @@\
  1190.     for i in dirs ;\                        @@\
  1191.     do \                                @@\
  1192.     if [ -d $$i ]; then \                        @@\
  1193.         (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \    @@\
  1194.             $(MAKE) $(MFLAGS) flags subname); \        @@\
  1195.     fi; \                                @@\
  1196.     done
  1197. #endif
  1198.  
  1199.  
  1200. /*
  1201.  * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
  1202.  * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
  1203.  * the following in the appropriate Imakefile
  1204.  * 
  1205.  *         #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  1206.  */
  1207. #ifndef NamedMakeSubdirs
  1208. #define NamedMakeSubdirs(name,dirs) \
  1209. NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
  1210. #endif /* NamedMakeSubdirs */
  1211.  
  1212. #ifndef MakeSubdirs
  1213. #define MakeSubdirs(dirs)                        @@\
  1214. NamedMakeSubdirs(all,dirs)
  1215. #endif /* MakeSubdirs */
  1216.  
  1217.  
  1218. /*
  1219.  * DependSubdirs - generate rules to recursively compute dependencies as
  1220.  * part of the make depend step.
  1221.  */
  1222. #ifndef DependSubdirs
  1223. #define DependSubdirs(dirs) \
  1224. NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
  1225. #endif /* DependSubdirs */
  1226.  
  1227.  
  1228. /*
  1229.  * ForceSubdirs - force make to build subdirectories
  1230.  */
  1231. #ifndef ForceSubdirs
  1232. #define ForceSubdirs(dirs)                        @@\
  1233. dirs: FRC                                @@\
  1234.     @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \        @@\
  1235.     $(MAKE) $(MFLAGS) PassCDebugFlags all                @@\
  1236.                                     @@\
  1237. FRC:
  1238. #endif /* ForceSubdirs */
  1239.  
  1240. /*
  1241.  * InstallSubdirs - generate rules to recursively install programs and files.
  1242.  */
  1243. #ifndef InstallSubdirs
  1244. #define InstallSubdirs(dirs) \
  1245. NamedTargetSubdirs(install,dirs,"installing",DESTDIR='$(DESTDIR)',install)
  1246. #endif /* InstallSubdirs */
  1247.  
  1248.  
  1249. /*
  1250.  * InstallManSubdirs - generate rules to recursively install manual pages.
  1251.  */
  1252. #ifndef InstallManSubdirs
  1253. #define InstallManSubdirs(dirs) \
  1254. NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR='$(DESTDIR)',install.man)
  1255. #endif /* InstallManSubdirs */
  1256.  
  1257.  
  1258. /*
  1259.  * IncludesSubdirs - generate rules to recursively put include files in build
  1260.  */
  1261. #ifndef IncludesSubdirs
  1262. #define IncludesSubdirs(dirs) \
  1263. NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
  1264. #endif
  1265.  
  1266.  
  1267. /*
  1268.  * CleanSubdirs - generate rules to recursively clean out garbage files.
  1269.  */
  1270. #ifndef NamedCleanSubdirs
  1271. #define NamedCleanSubdirs(name,dirs) \
  1272. NamedTargetSubdirs(name,dirs,"cleaning",RM_CMD='$(RM_CMD)',clean)
  1273. #endif /* NamedCleanSubdirs */
  1274.  
  1275. #ifndef CleanSubdirs
  1276. #define CleanSubdirs(dirs) \
  1277. NamedCleanSubdirs(clean,dirs)
  1278. #endif
  1279.  
  1280.  
  1281. /*
  1282.  * TagSubdirs - generate rules to recursively create tags files.
  1283.  */
  1284. #ifndef NamedTagSubdirs
  1285. #define NamedTagSubdirs(name,dirs) \
  1286. NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
  1287. #endif /* TagSubdirs */
  1288.  
  1289. #ifndef TagSubdirs
  1290. #define TagSubdirs(dirs) \
  1291. NamedTagSubdirs(tags,dirs)
  1292. #endif
  1293.  
  1294. /*
  1295.  * MakeLintSubdirs - generate rules to recursively lint directories as part 
  1296.  * of the named step.
  1297.  */
  1298. #ifndef MakeLintSubdirs
  1299. #define MakeLintSubdirs(dirs,target,subtarget) \
  1300. NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR='$(DESTDIR)' LINTOPTS='$(LINTOPTS)',subtarget)
  1301. #endif /* MakeLintSubdirs */
  1302.  
  1303.  
  1304. /*
  1305.  * LintSubdirs - generate rules to recursively lint directories as part of 
  1306.  * the make lint step.
  1307.  */
  1308. #ifndef LintSubdirs
  1309. #define LintSubdirs(dirs)                        @@\
  1310. MakeLintSubdirs(dirs,lint,lint)
  1311. #endif /* LintSubdirs */
  1312.  
  1313.  
  1314. /*
  1315.  * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
  1316.  */
  1317. #ifndef MakeLintLibSubdirs
  1318. #define MakeLintLibSubdirs(dirs)                    @@\
  1319. MakeLintSubdirs(dirs,lintlib,lintlib)
  1320. #endif /* MakeLintLibSubdirs */
  1321.  
  1322.  
  1323. /*
  1324.  * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
  1325.  * of the specified step in the build.  If $(TOP) is set to an absolute path, 
  1326.  * do not prepend the ../ prefix.  This makes running things outside of the 
  1327.  * source tree to be much easier.
  1328.  */
  1329. #ifndef MakeMakeSubdirs
  1330. #define MakeMakeSubdirs(dirs,target)                    @@\
  1331. target::                                @@\
  1332.     @case '${MFLAGS}' in *[ik]*) set +e;; esac; \            @@\
  1333.     for i in dirs ;\                        @@\
  1334.     do \                                @@\
  1335.     if [ -d $$i ]; then \                        @@\
  1336.         echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \    @@\
  1337.         case "$$i" in \                        @@\
  1338.         ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \    @@\
  1339.         ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \        @@\
  1340.         ./?*/?*)    newtop=../../ sub=subsub;; \        @@\
  1341.         ./?*)       newtop=../ sub=sub;; \            @@\
  1342.         */?*/?*/?*)    newtop=../../../../ sub=subsubsubsub;; \    @@\
  1343.         */?*/?*)    newtop=../../../ sub=subsubsub;; \        @@\
  1344.         */?*)       newtop=../../ sub=subsub;; \        @@\
  1345.         *)        newtop=../ sub=sub;; \            @@\
  1346.         esac; \                            @@\
  1347.         case "$(TOP)" in \                    @@\
  1348.         /?*) newtop=  upprefix=  ;; \                @@\
  1349.         *) upprefix=../ ;; \                    @@\
  1350.         esac; \                            @@\
  1351.         $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \        @@\
  1352.         MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\
  1353.     fi; \                                @@\
  1354.     done
  1355. #endif /* MakeMakeSubdirs */
  1356.  
  1357.  
  1358. /*
  1359.  * MakeNsubdirMakefiles - generate rules to create sub Makefiles.
  1360.  */
  1361. #ifndef MakeNsubdirMakefiles
  1362. #define MakeNsubdirMakefiles()                        @@\
  1363. subdirMakefiles:                            @@\
  1364.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@\
  1365.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@\
  1366.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1367.     else exit 0; fi                            @@\
  1368.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@\
  1369.     $(MAKE) $(MFLAGS) Makefiles                     @@\
  1370.                                     @@\
  1371. subsubdirMakefiles:                            @@\
  1372.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@\
  1373.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@\
  1374.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1375.     else exit 0; fi                            @@\
  1376.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@\
  1377.     $(MAKE) $(MFLAGS) Makefiles                     @@\
  1378.                                     @@\
  1379. subsubsubdirMakefiles:                            @@\
  1380.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@\
  1381.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@\
  1382.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1383.     else exit 0; fi @@\
  1384.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@\
  1385.     $(MAKE) $(MFLAGS) Makefiles                     @@\
  1386.                                     @@\
  1387. subsubsubsubdirMakefiles:                        @@\
  1388.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                @@\
  1389.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \        @@\
  1390.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1391.     else exit 0; fi                         @@\
  1392.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \    @@\
  1393.     $(MAKE) $(MFLAGS) Makefiles
  1394. #endif /* MakeNsubdirMakefiles */
  1395.  
  1396.  
  1397. /*
  1398.  * MakefileSubdirs - generate rules to create Makefiles.
  1399.  */
  1400. #ifndef MakefileSubdirs
  1401. #define MakefileSubdirs(dirs)                        @@\
  1402. MakeMakeSubdirs(dirs,Makefiles)                        @@\
  1403.                                     @@\
  1404. MakeNsubdirMakefiles()
  1405. #endif /* MakefileSubdirs */
  1406.  
  1407. /*
  1408.  * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
  1409.  * to cpp, because that trick does not work on all ANSI C preprocessors.
  1410.  * Also delete line numbers from the cpp output (-P is not portable, I guess).
  1411.  */
  1412. #ifndef CppSedMagic
  1413. #define CppSedMagic sed -e '/^#  *[0-9][0-9]*  *.*$$/d' \
  1414.             -e '/^XCOMM$$/s//#/' \
  1415.             -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
  1416. #endif /* CppSedMagic */
  1417.  
  1418. /*
  1419.  * CppScriptTarget - generate rules to create a shell script by running the
  1420.  * input through cpp.  If the ExecableScripts configuration parameter is not
  1421.  * set, then make sure that the first line begins with a colon.
  1422.  */
  1423. #ifndef CppScriptTarget
  1424. #if ExecableScripts        /* can use #! instead of colon */
  1425. #define CppScriptTarget(dst,src,defs,deplist)                @@\
  1426. dst::  src deplist                            @@\
  1427.     $(RM) $@                            @@\
  1428.     $(CPP) defs <src | CppSedMagic >$@                @@\
  1429.     chmod a+x $@
  1430. #else
  1431. #define CppScriptTarget(dst,src,defs,deplist)                @@\
  1432. dst::  src deplist                            @@\
  1433.     $(RM) $@                            @@\
  1434.     echo \: >$@                            @@\
  1435.     sed '1d' src | $(CPP) defs | CppSedMagic >>$@            @@\
  1436.     chmod a+x $@
  1437. #endif /* ExecableScripts */
  1438. #endif /* CppScriptTarget */
  1439.  
  1440.  
  1441. /*
  1442.  * MakeScriptFromCpp - generate rules to create a script from a file with a
  1443.  * .cpp suffix.
  1444.  */
  1445. #ifndef MakeScriptFromCpp
  1446. #define MakeScriptFromCpp(name,defs)                    @@\
  1447. CppScriptTarget(name,name.cpp,defs,NullParameter)
  1448. #endif /* MakeScriptFromCpp */
  1449.  
  1450. #ifndef CppFileTarget
  1451. #define CppFileTarget(dst,src,defs,deplist)                @@\
  1452. dst::  src deplist                            @@\
  1453.     $(RM) $@                            @@\
  1454.     $(CPP) defs <src | CppSedMagic >$@
  1455. #endif /* CppFileTarget */
  1456.  
  1457. /*
  1458.  * MakeDirectories - generate rules to create a hierarchy of directories.
  1459.  */
  1460. #ifndef MakeDirectories
  1461. #define MakeDirectories(step,dirs)                    @@\
  1462. step::                                    @@\
  1463.     @case '${MFLAGS}' in *[i]*) set +e;; esac;            @@\
  1464.     DirFailPrefix@for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \    @@\
  1465.         set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \    @@\
  1466.     done
  1467. #endif /* MakeDirectories */
  1468.  
  1469.  
  1470. /*
  1471.  * MakeFontsDir - generate rules to build fonts.dir database.
  1472.  */
  1473. #ifndef MakeFontsDir
  1474. #define MakeFontsDir(deplist)                        @@\
  1475. all:: fonts.dir                                @@\
  1476.                                     @@\
  1477. fonts.dir:  deplist                            @@\
  1478.     $(MKFONTDIR) .                            @@\
  1479.                                     @@\
  1480. clean::                                    @@\
  1481.     $(RM) fonts.dir
  1482. #endif /* MakeFontsDir */
  1483.  
  1484.  
  1485. /*
  1486.  * MakeFonts - generate rules to build font database.
  1487.  */
  1488. #ifndef MakeFonts
  1489. #define MakeFonts()                            @@\
  1490. all::  $(OBJS)                                @@\
  1491.                                     @@\
  1492. MakeFontsDir($(OBJS))                            @@\
  1493.                                     @@\
  1494. clean::                                    @@\
  1495.     $(RM) *.snf *.snf.Z *.pcf *.pcf.Z
  1496. #endif /* MakeFonts */
  1497.  
  1498.  
  1499. /*
  1500.  * InstallFontObjs - generate rules to install font files
  1501.  */
  1502. #ifndef InstallFontObjs
  1503. #define InstallFontObjs(objs,dest)                    @@\
  1504. InstallMultipleFlags(objs,dest,$(INSTDATFLAGS))                @@\
  1505.                                     @@\
  1506. install::  fonts.dir                            @@\
  1507.     MakeDir($(DESTDIR)dest)                        @@\
  1508.     $(INSTALL) -c $(INSTDATFLAGS) fonts.dir $(DESTDIR)dest
  1509. #endif /* InstallFontObjs */
  1510.  
  1511.  
  1512. /*
  1513.  * InstallFonts - generate rules to install font files
  1514.  */
  1515. #ifndef InstallFonts
  1516. #define InstallFonts(dest)                        @@\
  1517. InstallFontObjs($(OBJS),dest)
  1518. #endif /* InstallFonts */
  1519.  
  1520.  
  1521. /*
  1522.  * InstallFontAliases - generate rules to install font aliases databases. 
  1523.  */
  1524. #ifndef InstallFontAliases
  1525. #define InstallFontAliases(dest)                    @@\
  1526. install::  fonts.alias                            @@\
  1527.     MakeDir($(DESTDIR)dest)                        @@\
  1528.     $(INSTALL) -c $(INSTDATFLAGS) fonts.alias $(DESTDIR)dest
  1529. #endif /* InstallFontAliases */
  1530.  
  1531. #define FontSrc(basename) basename.bdf
  1532. #ifdef SnfFonts
  1533. #define FontBaseObj(basename) basename.snf
  1534. #else
  1535. #define FontBaseObj(basename) basename.pcf
  1536. #endif
  1537.  
  1538. /*
  1539.  * InstallFontScale - generate rules to install font scale database.
  1540.  */
  1541. #ifndef InstallFontScale
  1542. #define InstallFontScale(dest)                        @@\
  1543. install::  fonts.scale                            @@\
  1544.     MakeDir($(DESTDIR)dest)                        @@\
  1545.     $(INSTALL) -c $(INSTDATFLAGS) fonts.scale $(DESTDIR)dest
  1546. #endif /* InstallFontScale */
  1547.  
  1548. #define FontSrc(basename) basename.bdf
  1549. #ifdef SnfFonts
  1550. #define FontBaseObj(basename) basename.snf
  1551. #else
  1552. #define FontBaseObj(basename) basename.pcf
  1553. #endif
  1554.  
  1555. /*
  1556.  * UncompressedFontTarget
  1557.  */
  1558. #ifndef UncompressedFontTarget
  1559. #ifdef SnfFonts
  1560. #define UncompressedFontTarget(basename)                @@\
  1561. FontBaseObj(basename):  FontSrc(basename)                @@\
  1562.     $(FONTC) $(FONTCFLAGS) $? >$@
  1563. #else
  1564. #define UncompressedFontTarget(basename)                @@\
  1565. FontBaseObj(basename):  FontSrc(basename)                @@\
  1566.     $(FONTC) $(FONTCFLAGS) $? -o $@
  1567. #endif
  1568. #endif /* CompressedFontTarget */
  1569.  
  1570. /*
  1571.  * CompressedFontTarget
  1572.  */
  1573. #ifndef CompressedFontTarget
  1574. #define CompressedFontTarget(basename)                    @@\
  1575. FontBaseObj(basename).Z:  FontSrc(basename)                @@\
  1576.     $(FONTC) $(FONTCFLAGS) $? | $(COMPRESS) > $@
  1577. #endif /* CompressedFontTarget */
  1578.  
  1579. #ifdef CompressAllFonts
  1580. #define FontTarget(basename) CompressedFontTarget(basename)
  1581. #define FontObj(basename) FontBaseObj(basename).Z
  1582. #else
  1583. #define FontTarget(basename) UncompressedFontTarget(basename)
  1584. #define FontObj(basename) FontBaseObj(basename)
  1585. #endif /* CompressAllFonts */
  1586.  
  1587. /*
  1588.  * AllTarget - generate rules to build necessary things during make all.
  1589.  */
  1590. #ifndef AllTarget
  1591. #define AllTarget(depends)                        @@\
  1592. all:: depends
  1593. #endif /* AllTarget */
  1594.  
  1595. #ifndef LexTarget2
  1596. #define    LexTarget2(name)                        @@\
  1597. name.C: name.l                                @@\
  1598.     $(LEX) $(STD_YLFLAGS) $(LFLAGS) name.l                @@\
  1599.     $(MV) lex.yy.c name.C                        @@\
  1600.                                     @@\
  1601. clean::                                    @@\
  1602.     $(RM) name.C
  1603. #endif /* LexProgramTarget */
  1604.  
  1605. #ifndef LexTarget
  1606. #define    LexTarget(name)                            @@\
  1607. name.c: name.l                                @@\
  1608.     $(LEX) $(STD_YLFLAGS) $(LFLAGS) name.l                @@\
  1609.     $(MV) lex.yy.c name.c                        @@\
  1610.                                     @@\
  1611. clean::                                    @@\
  1612.     $(RM) name.c
  1613. #endif /* LexProgramTarget */
  1614.  
  1615. #ifndef YaccTarget
  1616. #if HasBison
  1617. #define    YaccTarget2(name)                        @@\
  1618. name.C: name.y                                @@\
  1619.     $(YACC) $(STD_YFLAGS) $(YFLAGS) name.y                @@\
  1620.     $(MV) name.tab.c name.C                        @@\
  1621.     $(MV) name.tab.h name.h                        @@\
  1622.                                     @@\
  1623. clean::                                    @@\
  1624.     $(RM) name.C name.h
  1625. #define    YaccTarget(name)                        @@\
  1626. name.c: name.y                                @@\
  1627.     $(YACC) $(STD_YFLAGS) $(YFLAGS) name.y                @@\
  1628.     $(MV) name.tab.c name.c                        @@\
  1629.     $(MV) name.tab.h name.h                        @@\
  1630.                                     @@\
  1631. clean::                                    @@\
  1632.     $(RM) name.c name.h
  1633. #else
  1634. #define    YaccTarget(name)                        @@\
  1635. name.c: name.y                                @@\
  1636.     $(YACC) $(STD_YFLAGS) $(YFLAGS) name.y                @@\
  1637.     $(MV) y.tab.c name.c                        @@\
  1638.     $(MV) y.tab.h name.h                        @@\
  1639.                                     @@\
  1640. clean::                                    @@\
  1641.     $(RM) name.c name.h
  1642. #endif
  1643. #endif /* YaccProgramTarget */
  1644.  
  1645. #ifndef ApigenManPages
  1646. #define    ApigenManPages(name)                        @@\
  1647. APIFILES=name.h name/**/P.h name/**/api.C name/**/proto.C Api.C Server.C @@\
  1648. install.man::                                @@\
  1649. MakeDir (man)                                @@\
  1650.     $(APIGEN) $(APIFLAGS) -d $(TOP)/man/dictionary -m name        @@\
  1651.     MakeDir($(DESTDIR)man/name)                    @@\
  1652.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \            @@\
  1653.     cd man; for i in `ls`; do \                    @@\
  1654.         (set -x; ../$(INSTALL) -c -m 0644 $$i $(DESTDIR)man/name) \    @@\
  1655.     done                                @@\
  1656. clean::                                    @@\
  1657.     $(RM) -r man
  1658. #endif /* ApigenManPages */
  1659.  
  1660. #ifndef ApigenTarget
  1661. #define    ApigenTarget(name)                        @@\
  1662. APIFILES=name.h name/**/P.h name/**/api.C name/**/proto.C Api.C Server.C @@\
  1663. all:: $(APIFILES)                            @@\
  1664. ApigenManPages (name)                            @@\
  1665.                                     @@\
  1666. $(APIFILES):                                @@\
  1667.     $(APIGEN) -a name                        @@\
  1668. clean::                                    @@\
  1669.     $(RM) $(APIFILES)
  1670. #endif /* ApigenTarget */
  1671.  
  1672. #ifndef AnsiTarget
  1673. #define    AnsiTarget(name, srcs)                        @@\
  1674. all:: name.h                                @@\
  1675. name.h:    $(SRCS)                                @@\
  1676.     $(TOP)/config/fansi $(ANSIFLAGS) srcs > name.h                @@\
  1677. clean::                                    @@\
  1678.     $(RM) name.h
  1679. #endif /* AnsiProgramTarget */
  1680.  
  1681. #ifndef SansiTarget
  1682. #define    SansiTarget(name, srcs)                        @@\
  1683. all:: name.h                                @@\
  1684. name.h:                                    @@\
  1685.     $(APIGEN) -s srcs > name.h                @@\
  1686. clean::                                    @@\
  1687.     $(RM) name.h
  1688. #endif /* SansiProgramTarget */
  1689.  
  1690. #ifndef MergeLibrary
  1691. #define MergeLibrary(tolib, fromlib, name)                @@\
  1692. tolib::  fromlib                            @@\
  1693.     $(SCRIPTSRC)/mergelib tolib fromlib name
  1694. #endif /* MergeLibrary */
  1695.  
  1696. #ifdef DefineOldLibraryRules
  1697. #include <oldlib.rules>
  1698. #endif
  1699.